{extend name="layout/tpl" /}
{block name="css"}
{__block__}
{/block}
{block name="title"}{$title ?? ''}{/block}
{block name="content"}
{__block__}
<div class="weadmin-body newCommonFixBlock">
	<form class="layui-form" action="" style="margin-top: 15px;">
		<div class="fixedTop">
		</div>

		<div class="contentAuto">
			<!--  基本资料 start -->
			<div class="writeBgBlock" id="base-info">
				<h5 class="titleHeader">格式化数据</h5>
				<div class="infoBlock">
					<div class="layui-row">
						<div class="layui-col-xs12">
							<div class="grid-demo">
								<textarea rows="30" placeholder="请粘贴此处"  name="lines" class="layui-textarea"></textarea>
							</div>
						</div>
					</div>
				</div>
			</div>


		</div>

		<div class="fixedBottom">
			<button type="button" lay-submit="" lay-filter="submit" class="layui-btn layui-btn-sm">提交</button>
			<button type="button" onclick="closeIframe();" class="layui-btn layui-btn-primary layui-btn-sm">取消</button>
		</div>
	</form>
</div>

<script type="text/html" id="toolbar-item">
</script>

<script type="text/html" id="bar-item">
	<a class="layui-btn layui-btn-xs layui-btn-normal " lay-event="edit">编辑</a>
</script>

<script type="text/html" id="bar-invoice">
	<a class="layui-btn layui-btn-danger layui-btn-xs menu-del" lay-event="del">删除</a>
</script>
{/block}
{block name="footerjs"}
{__block__}
<script type="text/javascript">
	var parentIndex = null;
	try{
		parentIndex = parent.layer.getFrameIndex(window.name); //获取窗口索引
	}catch (e) {
		console.log(e);
	}
	layui.use(['laypage','table','form','laydate','upload'], function () {
		var form = layui.form
				,table = layui.table //表格
				,laydate = layui.laydate//日期
				,$ = layui.$
				,upload = layui.upload
		;


		var $ = layui.$, active = {

		};
		$('.layui-btn').on('click', function(){
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
		});

	});

	layui.use('form', function(){ // 提交表单
		var form = layui.form;
		form.on('submit(submit)',function(data){
			var index;
			data.field.submit_status = data.elem.value;
			$.ajax({
				type:       'post',
				data:       data.field,
				dataType:   'json',
				beforeSend: function () {
					index = layer.load(0, {shade: [0.2, '#393D49']});
				},
				success:    function (result) {
					layer.close(index);
					if(result.code == 1) {
						var msg = '数据总数【'+ result.data.total + '】条，成功处理【'+ result.data.success  + '】条';
						layer.alert(msg, function(index){
							// parent.tableObj.reload('list');
							parent.$('button[data-type="search"]').click();
							parent.layer.close(parentIndex);
						});

					} else {
						layer.msg(result.msg,{icon: 5});
					}
				}
			});
			return false;   // 阻止表单跳转
		});
	});

</script>
{/block}